home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Resource for Source: C/C++
/
Resource for Source - C-C++.iso
/
codelib9
/
v_11_01
/
1101118b
< prev
next >
Wrap
Text File
|
1995-11-01
|
587b
|
31 lines
/* ftime.c: Compare file time stamps */
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <time.h>
main()
{
struct stat fs1, fs2;
if (stat("time1.c",&fs1) == 0 &&
stat("time2.c",&fs2) == 0)
{
double interval =
difftime(fs2.st_mtime,fs1.st_mtime);
printf("time1.c %s newer than time2.c\n",
(interval < 0.0) ? "is" : "is not");
return EXIT_SUCCESS;
}
else
return EXIT_FAILURE;
}
/* Output
time1.c is not newer than time2.c
*/
/* End of File */